/* 知识库页面样式 - 美化版 */

:root {
    --primary-gradient: linear-gradient(135deg, #4a6cf7 0%, #2b50ed 100%);
    --success-gradient: linear-gradient(135deg, #32be8f 0%, #38ef7d 100%);
    --warning-gradient: linear-gradient(135deg, #ffaa00 0%, #ffd500 100%);
    --danger-gradient: linear-gradient(135deg, #f5576c 0%, #f093fb 100%);
    --info-gradient: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%);
    --card-shadow: 0 2px 20px rgba(0, 0, 0, 0.06);
    --card-shadow-hover: 0 10px 30px rgba(0, 0, 0, 0.1);
    --dark-card-shadow: 0 2px 20px rgba(0, 0, 0, 0.2);
    --dark-card-shadow-hover: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* 文档卡片 */
.doc-card {
    background: var(--bs-white);
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    height: 100%;
    position: relative;
    border: none;
    overflow: hidden;
}

.dark-mode .doc-card {
    background: rgba(33, 37, 41, 0.8);
    box-shadow: var(--dark-card-shadow);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.doc-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--card-shadow-hover);
}

.dark-mode .doc-card:hover {
    box-shadow: var(--dark-card-shadow-hover);
    border-color: rgba(255, 255, 255, 0.1);
}

.doc-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary-gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.doc-card:hover::before {
    opacity: 1;
}

.doc-card-header {
    padding: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.dark-mode .doc-card-header {
    border-color: rgba(255, 255, 255, 0.05);
}

.doc-card-header .dropdown .btn-link {
    color: var(--bs-gray-500);
    transition: all 0.3s ease;
}

.dark-mode .doc-card-header .dropdown .btn-link {
    color: var(--bs-gray-400);
}

.doc-card-header .dropdown .btn-link:hover {
    color: var(--bs-primary);
    transform: rotate(90deg);
}

.doc-card-body {
    padding: 1.25rem;
}

.doc-title {
    margin-bottom: 0.75rem;
    color: var(--bs-gray-900);
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    transition: color 0.3s ease;
}

.doc-card:hover .doc-title {
    color: var(--bs-primary);
}

.dark-mode .doc-title {
    color: var(--bs-white);
}

.doc-meta {
    color: var(--bs-gray-600);
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
}

.doc-meta small {
    display: flex;
    align-items: center;
}

.doc-meta i {
    margin-right: 0.25rem;
}

.dark-mode .doc-meta {
    color: var(--bs-gray-400);
}

.doc-tags {
    margin-top: 0.75rem;
    display: flex;
    flex-wrap: wrap;
}

.doc-tags .badge {
    margin-right: 0.35rem;
    margin-bottom: 0.35rem;
    padding: 0.35rem 0.65rem;
    font-weight: 500;
    border-radius: 20px;
    transition: all 0.3s ease;
}

.doc-tags .badge:hover {
    transform: scale(1.05);
}

.badge.bg-primary {
    background: var(--primary-gradient) !important;
}

.badge.bg-success {
    background: var(--success-gradient) !important;
}

.badge.bg-warning {
    background: var(--warning-gradient) !important;
}

.badge.bg-danger {
    background: var(--danger-gradient) !important;
}

.badge.bg-info {
    background: var(--info-gradient) !important;
}

/* 列表视图 */
.list-item {
    background: var(--bs-white);
    border: none;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    transition: all 0.3s ease;
    box-shadow: var(--card-shadow);
    padding: 0.75rem 1rem !important;
}

.dark-mode .list-item {
    background: rgba(33, 37, 41, 0.8);
    box-shadow: var(--dark-card-shadow);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.list-item:hover {
    background: rgba(var(--bs-primary-rgb), 0.03);
    transform: translateX(5px);
    box-shadow: var(--card-shadow-hover);
}

.dark-mode .list-item:hover {
    background: rgba(255, 255, 255, 0.05);
    box-shadow: var(--dark-card-shadow-hover);
}

.list-item .doc-icon {
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(var(--bs-primary-rgb), 0.1);
    color: var(--bs-primary);
    transition: all 0.3s ease;
}

.dark-mode .list-item .doc-icon {
    background: rgba(var(--bs-primary-rgb), 0.2);
}

.list-item:hover .doc-icon {
    transform: scale(1.1);
}

.list-item .doc-info {
    padding-right: 1rem;
}

.list-item .doc-title {
    transition: all 0.3s ease;
    margin-bottom: 0.25rem;
}

.list-item:hover .doc-title {
    color: var(--bs-primary);
}

.list-item .doc-actions {
    opacity: 0;
    transition: all 0.3s ease;
}

.list-item:hover .doc-actions {
    opacity: 1;
}

.list-item .doc-actions .btn {
    border-radius: 6px;
    padding: 0.25rem 0.5rem;
    transition: all 0.3s ease;
}

.list-item .doc-actions .btn:hover {
    transform: translateY(-2px);
}

/* 上传区域 */
.upload-area {
    border: 2px dashed rgba(var(--bs-primary-rgb), 0.3);
    border-radius: 12px;
    padding: 2.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(var(--bs-primary-rgb), 0.02);
}

.dark-mode .upload-area {
    border-color: rgba(var(--bs-primary-rgb), 0.2);
    background: rgba(var(--bs-primary-rgb), 0.05);
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--bs-primary);
    background: rgba(var(--bs-primary-rgb), 0.05);
    transform: translateY(-3px);
    box-shadow: var(--card-shadow);
}

.dark-mode .upload-area:hover,
.dark-mode .upload-area.dragover {
    box-shadow: var(--dark-card-shadow);
    background: rgba(var(--bs-primary-rgb), 0.1);
}

.upload-area i {
    font-size: 2.5rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1.25rem;
    transition: all 0.3s ease;
}

.upload-area:hover i {
    transform: scale(1.1);
}

.upload-area p {
    margin-bottom: 0;
    color: var(--bs-gray-700);
    font-weight: 500;
}

.dark-mode .upload-area p {
    color: var(--bs-gray-300);
}

/* 导入选项 */
.import-options {
    margin-top: 1.5rem;
    background: rgba(var(--bs-light-rgb), 0.5);
    padding: 1.25rem;
    border-radius: 8px;
}

.dark-mode .import-options {
    background: rgba(255, 255, 255, 0.03);
}

.import-file-item {
    background: var(--bs-white);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease;
}

.import-file-item:hover {
    transform: translateX(3px);
}

.dark-mode .import-file-item {
    background: rgba(33, 37, 41, 0.5);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.form-check-input:checked {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
}

.form-check-input:focus {
    box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.25);
}

/* 分类树 */
.category-tree {
    padding: 1rem;
}

.category-tree ul {
    list-style: none;
    padding-left: 1.5rem;
}

.category-tree li {
    margin: 0.5rem 0;
}

.category-tree .category-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.category-tree .category-item:hover {
    background: rgba(var(--bs-primary-rgb), 0.05);
    transform: translateX(3px);
}

.dark-mode .category-tree .category-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.category-tree .category-item i {
    margin-right: 0.75rem;
    width: 16px;
    height: 16px;
    text-align: center;
    color: var(--bs-primary);
}

.category-tree .category-item .badge {
    margin-left: auto;
    border-radius: 20px;
    padding: 0.35rem 0.65rem;
    transition: all 0.3s ease;
}

.category-tree .category-item:hover .badge {
    background: var(--bs-primary) !important;
}

/* 工具栏 */
.toolbar {
    margin-bottom: 1.75rem;
    padding: 1.25rem;
    background: var(--bs-white);
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    transition: all 0.3s ease;
}

.toolbar:hover {
    box-shadow: var(--card-shadow-hover);
}

.dark-mode .toolbar {
    background: rgba(33, 37, 41, 0.8);
    box-shadow: var(--dark-card-shadow);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.dark-mode .toolbar:hover {
    box-shadow: var(--dark-card-shadow-hover);
}

.toolbar .btn-group {
    margin-right: 1rem;
}

.toolbar .btn-primary {
    background: var(--primary-gradient) !important;
    border: none;
    transition: all 0.3s ease;
}

.toolbar .btn-primary:hover {
    box-shadow: 0 5px 15px rgba(var(--bs-primary-rgb), 0.4);
    transform: translateY(-2px);
}

.toolbar .btn-outline-secondary {
    border-color: rgba(var(--bs-secondary-rgb), 0.3);
    color: var(--bs-gray-700);
    transition: all 0.3s ease;
}

.dark-mode .toolbar .btn-outline-secondary {
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--bs-gray-300);
}

.toolbar .btn-outline-secondary:hover {
    background: rgba(var(--bs-secondary-rgb), 0.1);
    border-color: rgba(var(--bs-secondary-rgb), 0.5);
    color: var(--bs-gray-900);
    transform: translateY(-2px);
}

.dark-mode .toolbar .btn-outline-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--bs-white);
}

.toolbar .form-select {
    width: auto;
    margin-right: 1rem;
    border-radius: 8px;
    border-color: rgba(0, 0, 0, 0.1);
    padding: 0.5rem 2.25rem 0.5rem 1rem;
    transition: all 0.3s ease;
}

.dark-mode .toolbar .form-select {
    background-color: rgba(33, 37, 41, 0.8);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--bs-gray-300);
}

.toolbar .form-select:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.25);
}

/* 搜索框 */
.search-box {
    position: relative;
    max-width: 300px;
}

.search-box .form-control {
    padding-left: 2.75rem;
    border-radius: 50px;
    border-color: rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    height: 42px;
}

.dark-mode .search-box .form-control {
    background-color: rgba(33, 37, 41, 0.8);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--bs-gray-300);
}

.search-box .form-control:focus {
    box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.25);
    border-color: var(--bs-primary);
}

.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--bs-gray-500);
    transition: all 0.3s ease;
}

.search-box .form-control:focus + i {
    color: var(--bs-primary);
}

/* 卡片 */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    transition: all 0.3s ease;
    overflow: hidden;
}

.dark-mode .card {
    background-color: rgba(33, 37, 41, 0.8);
    box-shadow: var(--dark-card-shadow);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.card:hover {
    box-shadow: var(--card-shadow-hover);
}

.dark-mode .card:hover {
    box-shadow: var(--dark-card-shadow-hover);
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1.25rem;
}

.dark-mode .card-header {
    border-color: rgba(255, 255, 255, 0.05);
}

.card-body {
    padding: 1.25rem;
}

.list-group-item {
    border-color: rgba(0, 0, 0, 0.05);
    padding: 0.75rem 1.25rem;
    transition: all 0.3s ease;
}

.dark-mode .list-group-item {
    background-color: transparent;
    border-color: rgba(255, 255, 255, 0.05);
    color: var(--bs-gray-300);
}

.list-group-item.active {
    background: var(--primary-gradient);
    border-color: transparent;
}

.list-group-item:hover:not(.active) {
    background-color: rgba(var(--bs-primary-rgb), 0.05);
}

.dark-mode .list-group-item:hover:not(.active) {
    background-color: rgba(255, 255, 255, 0.05);
}

/* 模态框 */
.modal-content {
    border-radius: 15px;
    border: none;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.dark-mode .modal-content {
    background: rgba(33, 37, 41, 0.95);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.4);
}

.modal-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1.5rem;
}

.dark-mode .modal-header {
    border-color: rgba(255, 255, 255, 0.05);
}

.modal-title {
    font-weight: 600;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1.5rem;
}

.dark-mode .modal-footer {
    border-color: rgba(255, 255, 255, 0.05);
}

.modal .btn-close:focus {
    box-shadow: none;
}

.dark-mode .modal .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* 表单控件 */
.form-control, .form-select {
    border-radius: 8px;
    padding: 0.6rem 1rem;
    border-color: rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.dark-mode .form-control, .dark-mode .form-select {
    background-color: rgba(33, 37, 41, 0.8);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--bs-gray-300);
}

.form-control:focus, .form-select:focus {
    box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.25);
    border-color: var(--bs-primary);
}

.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--bs-gray-700);
}

.dark-mode .form-label {
    color: var(--bs-gray-300);
}

/* 按钮 */
.btn {
    border-radius: 8px;
    padding: 0.6rem 1.2rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--primary-gradient);
    border: none;
}

.btn-primary:hover {
    box-shadow: 0 5px 15px rgba(var(--bs-primary-rgb), 0.4);
    transform: translateY(-2px);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.875rem;
}

.btn-link {
    text-decoration: none;
}

.btn-link:hover {
    text-decoration: none;
    color: var(--bs-primary);
}

/* 编辑器 */
.tox-tinymce {
    border-radius: 10px !important;
    overflow: hidden !important;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05) !important;
}

.dark-mode .tox-tinymce {
    border-color: rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2) !important;
}

/* Toast消息 */
.toast-container {
    z-index: 1060;
}

.toast {
    border-radius: 10px;
    border: none;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.dark-mode .toast {
    background: rgba(33, 37, 41, 0.9);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.toast.bg-success {
    background: var(--success-gradient) !important;
}

.toast.bg-warning {
    background: var(--warning-gradient) !important;
}

.toast.bg-danger {
    background: var(--danger-gradient) !important;
}

.toast.bg-info {
    background: var(--info-gradient) !important;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .toolbar {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .toolbar .btn-group,
    .toolbar .form-select,
    .toolbar .search-box {
        width: 100%;
        margin-right: 0;
    }

    .list-item {
        flex-wrap: wrap;
    }

    .list-item .doc-actions {
        width: 100%;
        margin-top: 0.75rem;
        opacity: 1;
    }

    .list-item .doc-actions .btn-group {
        width: 100%;
        justify-content: space-between;
    }

    .list-item .doc-actions .btn {
        flex: 1;
    }
    
    .modal-dialog {
        margin: 0.5rem;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(var(--bs-primary-rgb), 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(var(--bs-primary-rgb), 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(var(--bs-primary-rgb), 0);
    }
}

.doc-card,
.list-item {
    animation: fadeIn 0.5s ease-out forwards;
}

.doc-card:nth-child(odd) {
    animation-delay: 0.1s;
}

.doc-card:nth-child(even) {
    animation-delay: 0.2s;
}

.btn-primary:hover {
    animation: pulse 1.5s infinite;
}

/* 加载状态 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(var(--bs-body-bg-rgb), 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1050;
    backdrop-filter: blur(5px);
}

.loading-spinner {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    border: 3px solid rgba(var(--bs-primary-rgb), 0.2);
    border-top-color: var(--bs-primary);
    animation: spinner 1s linear infinite;
}

@keyframes spinner {
    to {
        transform: rotate(360deg);
    }
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--bs-gray-500);
    animation: fadeIn 0.5s ease-out;
}

.dark-mode .empty-state {
    color: var(--bs-gray-400);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.empty-state p {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.empty-state .btn {
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    background: var(--primary-gradient);
    border: none;
    box-shadow: 0 5px 15px rgba(var(--bs-primary-rgb), 0.3);
    transition: all 0.3s ease;
}

.empty-state .btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(var(--bs-primary-rgb), 0.5);
}

/* 标签云 */
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 1.25rem;
    animation: fadeIn 0.5s ease-out;
}

.tag-cloud .badge {
    font-size: 0.9rem;
    padding: 0.5rem 1.25rem;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(var(--bs-primary-rgb), 0.1);
    color: var(--bs-primary);
}

.dark-mode .tag-cloud .badge {
    background: rgba(var(--bs-primary-rgb), 0.2);
}

.tag-cloud .badge:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 5px 15px rgba(var(--bs-primary-rgb), 0.3);
    background: var(--primary-gradient);
    color: var(--bs-white);
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bs-gray-100);
    border-radius: 4px;
}

.dark-mode ::-webkit-scrollbar-track {
    background: rgba(33, 37, 41, 0.6);
}

::-webkit-scrollbar-thumb {
    background: var(--bs-gray-400);
    border-radius: 20px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.dark-mode ::-webkit-scrollbar-thumb {
    background: var(--bs-gray-600);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--bs-primary);
    border: 2px solid transparent;
    background-clip: padding-box;
}

.dark-mode ::-webkit-scrollbar-thumb:hover {
    background: var(--bs-primary);
}

/* 焦点状态 */
*:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
} 